package s.k.gui.webtest.unittest;

import java.util.Random;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.Test;

public class PaoPageTest extends PaoPageBaseTest {

	@Test
	public void GPUTest() throws InterruptedException {
		Random random = new Random();
		Select gameSelect = new Select(driver.findElement(By.id("ddl_game")));
		Select modeSelect = new Select(driver.findElement(By.id("ddl_mode")));
		Thread.sleep(3000);
		for (int i = 0; i < 10; i++) {
			int gameRand = random.nextInt(17) + 1;
			int modeRand = random.nextInt(1) + 1;
			gameSelect.selectByIndex(gameRand);
			modeSelect.selectByIndex(modeRand);
			Thread.sleep(1000);
			String gameName = driver.findElement(By.id("ddl_game"))
					.findElements(By.tagName("option")).get(gameRand).getText();
			String modeName = driver.findElement(By.id("ddl_mode"))
					.findElements(By.tagName("option")).get(modeRand).getText();
			String Text = driver.findElement(By.className("line_bg1"))
					.findElement(By.tagName("span")).getText();
			System.out.print("------>在游戏" + gameName + "模式" + modeName
					+ "的得分是");
			System.out.println(Text);
		}
		System.out
				.println("-------------------测试结束---------------------");
	}
}
